function ExplosionEffect(){

    this.width = 0;
    this.height = 0;

    this.posX = 0;
    this.posY = 0;
    this.usable = false;
    this.visible = false;
    this.imgs;

    this.effectCount = 0;
    this.effectTotal = 0;

    this.currentIndex = 0;
    this.totalIndex = 0;
    this.afterTimeTotal = 0;//延迟多久释放
    this.afterTimeCount = 0;
    var allInOne = false;

    this.InitExplosionEffect = function(centerX, centerY, width, height, imgs, totalFrame, effectTotal, afterTimeTotal, originAllInOne) {
        this.width = width;
        this.height = height;

        this.posX = centerX-width/2;
        this.posY = centerY-height/2;
        this.imgs = imgs;

        this.effectCount = 0;
        this.effectTotal = effectTotal;
        this.afterTimeTotal = afterTimeTotal;
        this.afterTimeCount = 0;

        this.currentIndex = 0;
        this.totalIndex = totalFrame;

        if(afterTimeTotal == 0){
            this.visible = true;
        }
        else{
            this.visible = false;
        }
        this.usable = true;

        allInOne = originAllInOne;
    };

    this.update = function(){
        if(this.usable){
            if(this.visible){
                if(this.effectCount == this.effectTotal){
                    this.currentIndex++;
                    this.effectCount = 0;
                }
                if(this.currentIndex == this.totalIndex){
                    this.visible = false;
                    this.usable = false;
                }
                this.effectCount++;
            }
            else{
                this.afterTimeCount++;
                if(this.afterTimeCount == this.afterTimeTotal){
                    this.visible = true;
                }
            }
        }
    }

    this.paint = function(drawCanvas){
        if(this.visible){
            if(allInOne){
                clipDrawFrame(this.imgs, 0, this.currentIndex*this.height, this.posX, this.posY, this.width, this.height, drawCanvas);
            }
            else{
                drawCanvas.drawImage(this.imgs[this.currentIndex], this.posX, this.posY);
            }
        }
    }
}